package top.yangbuyi;


import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @description: 杨不易网站:www.yangbuyi.top
 * @program: yangbuyiopenHis2020
 * @ClassName: StatistcsApplication
 * @create: 2020-08-27 10:06
 * @author: yangbuyi
 * @since： JDK1.8
 * @StatistcsApplication:
 **/

@SpringBootApplication
@Slf4j
@EnableDubbo
@MapperScan(basePackages = {"top.yangbuyi.mapper"})
public class StatisticsApplication {

	  public static void main(String[] args) throws UnknownHostException {
			ConfigurableApplicationContext application = SpringApplication.run(StatisticsApplication.class, args);
			Environment env = application.getEnvironment();
			String ip = InetAddress.getLocalHost().getHostAddress();
			String port = env.getProperty("server.port");
			String path = env.getProperty("server.servlet.context-path");
			String serverName = env.getProperty("spring.application.name");
			String active = env.getProperty("spring.profiles.active");
			String fileExtension = env.getProperty("spring.cloud.nacos.config.file-extension");
			log.info("\n--------------------------------------------------------------------------\n\t" +
					"|                    欢迎使用统计分析子模块          \t\t\t\t\t" + "|\n\t" +
					"|Application yangbuyi-his is running! Access URLs:\t\t\t\t\t" + "|\n\t" +
					"|访问URL: \t\thttp://localhost:" + port + path + "/\t\t\t\t\t" + "|\n\t" +
					"|当前配置环境: \t\t当前环境为:" + active + "\t\t\t\t\t\t\t\t\t" + "|\n\t" +
					"|配置文件名称: \t\t" + serverName + "-" + active + "." + fileExtension + "\t\t\t\t\t\t\t|\n\t" +
					"---------------------------------------------------------------------");
			log.info("\n ____  ____   ______     ____  ____            ____  ____     _____      ______              ______    _________        _        _________   _____    ______    _________   _____     ______    ______   \n" +
					"|_  _||_  _| |_   _ \\   |_  _||_  _|          |_   ||   _|   |_   _|   .' ____ \\           .' ____ \\  |  _   _  |      / \\      |  _   _  | |_   _| .' ____ \\  |  _   _  | |_   _|  .' ___  | .' ____ \\  \n" +
					"  \\ \\  / /     | |_) |    \\ \\  / /    ______    | |__| |       | |     | (___ \\_|  ______  | (___ \\_| |_/ | | \\_|     / _ \\     |_/ | | \\_|   | |   | (___ \\_| |_/ | | \\_|   | |   / .'   \\_| | (___ \\_| \n" +
					"   \\ \\/ /      |  __'.     \\ \\/ /    |______|   |  __  |       | |      _.____`.  |______|  _.____`.      | |        / ___ \\        | |       | |    _.____`.      | |       | |   | |         _.____`.  \n" +
					"   _|  |_     _| |__) |    _|  |_              _| |  | |_     _| |_    | \\____) |          | \\____) |    _| |_     _/ /   \\ \\_     _| |_     _| |_  | \\____) |    _| |_     _| |_  \\ `.___.'\\ | \\____) | \n" +
					"  |______|   |_______/    |______|            |____||____|   |_____|    \\______.'           \\______.'   |_____|   |____| |____|   |_____|   |_____|  \\______.'   |_____|   |_____|  `.____ .'  \\______.' \n" +
					"                                                                                                                                                                                                         ");



	  }

}
